<?php
 @require_once("toubu.php");
$carid=$_GET["carid"];
$userid=$_GET["userid"];
$goodsnum=$_GET["goodsnum"];
$sql="SELECT COUNT(*) from guccicar where id= $carid and userid =$userid";
$result=mysql_query($sql);
$count=mysql_fetch_array($result);
if($count[0]>0){//大于0商品存在,数量加增加
    $sqlo="UPDATE guccicar SET goodsnum=$goodsnum WHERE userid = $userid AND id = $carid";
    }else{//商品不存在,新增
       die ('0');
    }
    mysql_query($sqlo);
$count = mysql_affected_rows();

echo json_encode($count);
    